<template>
  <div id="app">
    <router-view></router-view>
  </div>
</template>

<script>
function getCookie(Name) {
  var search = Name + "="//查询检索的值
  var returnvalue = "";//返回值
  if (document.cookie.length > 0) {
    var sd = document.cookie.indexOf(search);
    if (sd!= -1) {
      sd += search.length;
      var end = document.cookie.indexOf(";", sd);
      if (end == -1)
        end = document.cookie.length;
      //unescape() 函数可对通过 escape() 编码的字符串进行解码。
      returnvalue= document.cookie.substring(sd, end);
    }
  }
  return returnvalue;
}
var wxuname = decodeURIComponent(getCookie('wxuname'));
var wxavatar =  decodeURIComponent(getCookie('wxavatar'));
if(!wxuname && !wxavatar && location.host=='h5.oeeee.com'){
    location.href = 'http://h5.oeeee.com/index.php?s=/StaticH5/chat';
}
window.$user = {
  name : wxuname,
  head : wxavatar
}
export default {
  name: 'app'
}
window.$wxShare = function() {
  var config = oe_wxconfig,
    title = "南方都市报邀你加入“两会记者”私密群聊",
    summary = "看到此消息的都是真爱",
    link = "http://h5.oeeee.com/index.php?s=/StaticH5/chat",
    thumb = "http://img1.ndapp.oeeee.com/avatar/180x180_573be4065fdfe.jpg",
    content = {
      title: title,
      desc:summary,
      link: link,
      imgUrl:thumb,
      type: '',
      dataUrl: '',
      success: function () {},
      cancel: function () {}
    }

  wx.config({
    debug: false,
    appId: config.appId,
    timestamp: config.timestamp,
    nonceStr: config.nonceStr,
    signature: config.signature,
    jsApiList: [
      'onMenuShareAppMessage','onMenuShareTimeline','onMenuShareQQ','onMenuShareWeibo'
    ]
  });
  wx.checkJsApi({
    jsApiList: ['onMenuShareAppMessage','onMenuShareTimeline','onMenuShareQQ','onMenuShareWeibo'],
    success: function(res) {}
  });
  wx.ready(function () {
    wx.onMenuShareAppMessage(content);
    wx.onMenuShareTimeline(content);
    wx.onMenuShareQQ(content);
    wx.onMenuShareWeibo(content);
  });
}
//微信分享
var ua = window.navigator.userAgent.toLowerCase();
if(ua.match(/MicroMessenger/i) == 'micromessenger'){
  $wxShare();
}

</script>

<style rel="stylesheet/less" lang="less" scoped>
  @rex-screen : 750;
  @rem : @rex-screen/10rem;

  #app {
    font-family: 'PingFangSC-Regular','Microsoft YaHei', Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: #2c3e50;
    font-size:32/@rem;
    height: 100%;
  }
</style>
